﻿// This code is released under the BSD license.
namespace PugLib.Functional
{
    using System.Diagnostics.CodeAnalysis;

    public class Maybe<T>
    {
        [SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible")]
        [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
        public static readonly Maybe<T> Nothing = new Maybe<T>();

        private Maybe()
        {
            HasValue = false;
        }

        public Maybe(T value)
        {
            Value = value;
            HasValue = true;
        }

        public T Value { get; private set; }
        public bool HasValue { get; private set; }
    }
}